#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int removeElement(int* arr, int arrSize, int val) {
	int src = 0;
	int dst = 0;
	while (src < arrSize) {
		if (arr[src] != val) {
			arr[dst] = arr[src];
			src++;
			dst++;
		}
		else {
			src++;
		}
	}
	return dst;
}
void printfArr(int* arr,int arrSize) {
	for (int i = 0; i < arrSize; i++) {
		printf("%d ", arr[i]);
	}
	printf("\n");
}
int main() {
	int arr[5] = { 1,2,3,4,5 };
	int result = removeElement(arr, 5, 2);
	printfArr(arr, 4);
	printf("%d\n", result);
	return 0;
}